#include "abilityInfo.ani.hpp"
#include "applicationInfo.ani.hpp"
#include "bundleInfo.ani.hpp"
#include "customizeData.ani.hpp"
#include "elementName.ani.hpp"
#include "hapModuleInfo.ani.hpp"
#include "moduleInfo.ani.hpp"
#include "ohos_app_ability_want.ani.hpp"
#include "ohos_bundle.ani.hpp"
#include "shortcutInfo.ani.hpp"
#if __has_include(<ani.h>)
#include <ani.h>
#elif __has_include(<ani/ani.h>)
#include <ani/ani.h>
#else
#error "ani.h not found. Please ensure the Ani SDK is correctly installed."
#endif
ANI_EXPORT ani_status ANI_Constructor(ani_vm *vm, uint32_t *result) {
  ani_env *env;
  if (ANI_OK != vm->GetEnv(ANI_VERSION_1, &env)) {
    return ANI_ERROR;
  }
  if (ANI_OK != customizeData::ANIRegister(env)) {
    std::cerr << "Error from customizeData::ANIRegister" << std::endl;
    return ANI_ERROR;
  }
  if (ANI_OK != ohos_app_ability_want::ANIRegister(env)) {
    std::cerr << "Error from ohos_app_ability_want::ANIRegister" << std::endl;
    return ANI_ERROR;
  }
  if (ANI_OK != moduleInfo::ANIRegister(env)) {
    std::cerr << "Error from moduleInfo::ANIRegister" << std::endl;
    return ANI_ERROR;
  }
  if (ANI_OK != elementName::ANIRegister(env)) {
    std::cerr << "Error from elementName::ANIRegister" << std::endl;
    return ANI_ERROR;
  }
  if (ANI_OK != abilityInfo::ANIRegister(env)) {
    std::cerr << "Error from abilityInfo::ANIRegister" << std::endl;
    return ANI_ERROR;
  }
  if (ANI_OK != shortcutInfo::ANIRegister(env)) {
    std::cerr << "Error from shortcutInfo::ANIRegister" << std::endl;
    return ANI_ERROR;
  }
  if (ANI_OK != ohos_bundle::ANIRegister(env)) {
    std::cerr << "Error from ohos_bundle::ANIRegister" << std::endl;
    return ANI_ERROR;
  }
  if (ANI_OK != hapModuleInfo::ANIRegister(env)) {
    std::cerr << "Error from hapModuleInfo::ANIRegister" << std::endl;
    return ANI_ERROR;
  }
  if (ANI_OK != applicationInfo::ANIRegister(env)) {
    std::cerr << "Error from applicationInfo::ANIRegister" << std::endl;
    return ANI_ERROR;
  }
  if (ANI_OK != bundleInfo::ANIRegister(env)) {
    std::cerr << "Error from bundleInfo::ANIRegister" << std::endl;
    return ANI_ERROR;
  }
  *result = ANI_VERSION_1;
  return ANI_OK;
}
